package com.avic.rong.utils;

import android.graphics.Color;
import android.os.CountDownTimer;
import android.view.View;
import android.widget.TextView;

import org.w3c.dom.Text;

public class TimeCount extends CountDownTimer {

    TextView textView;

    boolean flag;



    public TimeCount(long millisInFuture, long countDownInterval, TextView textView, boolean flag) {
        super(millisInFuture, countDownInterval);
        this.textView = textView;
        this.flag = flag;
    }


    @Override
    public void onTick(long millisUntilFinished) {
//        textView.setBackgroundColor(Color.parseColor("#B6B6D8"));
        textView.setClickable(false);
        textView.setText("("+millisUntilFinished / 1000 +") 秒后可重新发送");
        if (flag == true){
            textView.setTextSize(10);
        }else {
            return;
        }
    }

    @Override
    public void onFinish() {
        textView.setText("重新获取验证码");
        textView.setClickable(true);
//        textView.setBackgroundColor(Color.parseColor("#4EB84A"));
        if (flag == true){
            textView.setTextSize(10);
        }else {
            return;
        }
    }
}
